/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.krazevina.kar;

import com.sun.lwuit.Label;
import java.util.Vector;
import javax.microedition.rms.RecordStore;

/**
 *
 * @author XXX
 */
public class Taxi{
    String name,num;
    int ind;
    boolean bookmark = false;
    Label lbfav;
    public static void getBookmark(TaxiResource t) throws Exception{
        RecordStore rs = RecordStore.openRecordStore("bookmarkTaxi", true);
        byte[]b;int in;
        for(int i=0;i<rs.getNextRecordID();i++){
            try{
                b = rs.getRecord(i);
                in = AddressBook.Int(b);
                t.getTaxi(in).bookmark = true;
            }catch(Exception e){
            }
        }
    }
    public void unBookmark() throws Exception{
        RecordStore rs = RecordStore.openRecordStore("bookmarkTaxi", true);
        byte[]b;int in;
        for(int i=0;i<rs.getNextRecordID();i++){
            try{
                b = rs.getRecord(i);
                in = AddressBook.Int(b);
                if(in == ind)rs.deleteRecord(i);
                return;
            }catch(Exception e){
            }
        }
    }
    public void bookmark() throws Exception{
        RecordStore rs = RecordStore.openRecordStore("bookmarkTaxi", true);
        byte[]b;
        b = AddressBook.Bytes(ind);
        try{
            rs.addRecord(b, 0, b.length);
        }catch(Exception e){
        }
    }
}
